<html>
  <head>
    <title>美业红</title>
    <meta http-equiv="content-type" content="text/php;charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1">
    <script type='text/javascript' src='/public/js/jquery-1.11.2.min.js'></script>   
    <link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.2.0/css/bootstrap.min.css">
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script type="text/javascript" src='/public/js/jquery.validate.js'></script>
    <link href="/public/css/main.css" rel="stylesheet">
  </head>
  <body>
        <div class="container" style='margin-top:10rem;'>                 
                            <img src="/public/images/barber.jpg" class="img-circle" alt="123" width="304" height="236"> 
                        </div>
                        <form class="form-horizontal" style='margin-top:5rem;' id='forms' action='/admin/user/submit' method='post'>       
                            <div class="form-group">
                                <label for="exampleInputName2" class="col-sm-2 control-label" style='height: 50px'>姓名</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" name="name" placeholder="请输入姓名">
                                </div>
                            </div>
                             <div class="form-group">
                                <label for="exampleInputName2" class="col-sm-2 control-label" style='height: 50px'>账号</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control" name="account" placeholder="请输入手机号码">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="exampleInputName2" class="col-sm-2 control-label" style='height: 50px'>密码</label>
                                <div class="col-sm-10">
                                    <input type="password" class="form-control" id="password" name="password" placeholder="请输入密码6~12位">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="exampleInputName2" class="col-sm-2 control-label" style='height: 50px'>确认密码</label>
                                <div class="col-sm-10">
                                    <input type="password" class="form-control" name="repassword" placeholder="请输入相同密码">
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-2 col-sm-10">
                                    <input type="hidden" name='is_admin' value='0' />
                                    <button type="submit" class="btn btn-default">创建</button>
                                </div>
                            </div>
                        </form>

<script type='text/javascript'>
    $(document).ready(function () {
        $("#forms").validate({
            rules: {
                name: {
                    required: true,
                    rangelength: [1, 10]
                },
                account: {
                    required: true,
                    number: true,
                    mobile: true
                },
                password: {
                    required: true,
                    rangelength: [6, 12]
                },
                repassword: {
                    required: true,
                    rangelength: [6, 12],
                    equalTo: "#password"
                }
            },
            messages: {
                name: {
                    required: '请输入姓名',
                    rangelength: '请输入最多5个中文字符',
                },
                account: {
                    required: '请输入手机号',
                    number: '请输入手机号',
                    mobile: '请输入手机号'
                },
                password: {
                    required: '请输入密码：6-12位',
                    rangelength: '请输入密码：6-12位'
                },
                repassword: {
                    required: '请输入密码：6-12位',
                    rangelength: '请输入密码：6-12位',
                    equalTo: '两次密码不一致'
                },
            }
        });
        jQuery.validator.addMethod("mobile", function (value, element) {
            var length = value.length;
            var mobile = /^(((1[1-9]{1}[0-9]{1})|(15[0-9]{1}))+\d{8})$/
            return this.optional(element) || (length == 11 && mobile.test(value));
        }, "手机号码格式错误");
    });
</script>
  </body>
  </html>